//封装banner轮播图相关的业务逻辑

import { ref, onMounted } from 'vue'
import { getBannerAPI } from '@/apis/home'

export function useBanner() {
  // 获取轮播图
const bannerList = ref([])
const getBanner = async () => {
  const { result } = await getBannerAPI({ distributionSite: '2' })
  bannerList.value = result
}
onMounted(() => {
  getBanner()
})
  // 函数内部把组件中需要用到的数据或者方法return出去
  return {
    bannerList
  }
}